package qtask

import (
	"fmt"

	"gitee.com/micro-plat/qtask/internal/modules/const/conf"
	"gitee.com/micro-plat/qtask/internal/services"
	"github.com/micro-plat/hydra"
)

//BindFlow 绑定自动流程(调用后将自动扫描数据库后补队列数据，并定期清除过期数据)
func BindFlow() {
	hydra.S.CRON("/task/scan", services.Scan, fmt.Sprintf("@every %ds", conf.ScanInterval)) //定时扫描任务
	hydra.S.CRON("/task/close", services.Close(), "*/1 0-2 * * *")                          //定时关闭任务(0-2点执行,每分钟执行一次)
	hydra.S.CRON("/task/clear", services.Clear(), "15 2 * * *")                             //定时清理任务（2点15定时删除）
}
